<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="IE=edge" >
    <meta name="referrer" content="no-referrer-when-downgrade" />
    <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"/>
    <title>Aliplayer Online Settings</title>
    <link rel="stylesheet" href="https://static.zpimg.cn/public/alipalyer/aliplayer_2.8.2.css" />
    <script type="text/javascript" charset="utf-8" src="https://static.zpimg.cn/public/alipalyer/aliplayer_2.8.2.js"></script>
</head>
<body>
<div class="prism-player" id="player-con"></div>
<script src="https://static.zpimg.cn/public/js/jquery-1.11.3.min.js"></script>
<script>

    var domain = 'https://211.70.2.182:8081';

    setInterval(function () {
        window.location.reload();
    }, 5000)

    $(document).ready(function(){
        $.get(domain + "/video-times/video-time", function(data){
            var player = new Aliplayer({
                    "id": "player-con",
                    "source": data.url,
                    "width": "100%",
                    "height": "500px",
                    "autoplay": true,
                    "isLive": false,
                    "rePlay": false,
                    "playsinline": true,
                    "preload": true,
                    "controlBarVisibility": "hover",
                    "useH5Prism": true
                }, function (player) {
                    player.mute()
                }
            );

            player.on('ready',function(){
                var time = player.getDuration();
                $.post(domain + "/video-times/update-video/"+data.video_id, {'time':time,'id':data.id, 'sid': data.sid}, function(res){
                    console.log(res);
                })
                window.clearTimeout(timer);
            });

            player.on('error',function(err){
                $.post(domain + "/video-times/video-error/"+data.id, {'video_id':data.video_id, 'type':1, 'sid': data.sid}, function(res){
                    console.log(1);
                })
            });

            timer = window.setTimeout(function(){
                $.post(domain + "/video-times/video-error/"+data.id, {'video_id':data.video_id, 'type':2, 'sid': data.sid}, function(res){
                    console.log(res);
                })
            },4500);
        })
    })

</script>
</body>
